Skip to content

Allow data to be passed as sass option#216

Merged
jhnns merged 1 commit intowebpack:masterfrom
fahad19:data-injection
Mar 3, 2016
Merged

Allow data to be passed as sass option#216
jhnns merged 1 commit intowebpack:masterfrom
fahad19:data-injection

Conversation

@fahad19
Copy link
Contributor

@fahad19 fahad19 commented Feb 15, 2016

It's a very rare use case, but wanted to create a PR to find out if it's worthwhile making it to sass-loader too.

Why?

  • I used the sassOptions.data key to inject some dynamic Sass variables
  • node-sass itself allows data to be passed in sassOptions

But...

sass-loader overwrites sassOptions.data which means I can't do the variable injection any more.

Solution

Check if sassOptions.data is present first, and if yes, then prepend that before file content. Otherwise, just roll with the file content as normal.

jhnns added a commit that referenced this pull request Mar 3, 2016
Allow `data` to be passed as sass option
@jhnns jhnns merged commit 5af9717 into webpack:master Mar 3, 2016
@jhnns
Copy link
Member

jhnns commented Mar 3, 2016

Sounds good 👍
@mrfr0g: Is this a solution for #191?

@jhnns
Copy link
Member

jhnns commented Mar 12, 2016

Shipped with v3.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants